﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;

namespace DAO
{
    public class ChucVuDAO
    {
        public static List<ChucVuDTO> SelectAll()
        {
            List<ChucVuDTO> list = new List<ChucVuDTO>();
            String strSql = "select * from ChucVu where MaCV<>1";

            try
            {
                DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql);
                foreach (DataRow dr in dt.Rows)
                {
                    ChucVuDTO cv = new ChucVuDTO();
                    cv.MaChucVu = int.Parse(dr["MaCV"].ToString());
                    cv.TenChucVu = dr["TenChucVu"].ToString();
                    list.Add(cv);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
    }
}
